package com.ycc.controller;

import com.ycc.service.WxLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class WxLoginController {

    @Autowired
    private WxLoginService wxLoginService;

    @PostMapping("/wxlogin")
    public Map<String, String> wxLogin(@RequestBody Map<String, String> req) {
        String token = wxLoginService.wxLogin(req);
        return new HashMap<String, String>() {{
            put("token", token);
        }};

    }

}